//
//  VSFindClothesCollectionViewCell.m
//  UI项目2.0
//
//  Created by dlios on 15/7/15.
//  Copyright (c) 2015年 星际科技. All rights reserved.
//

#import "VSFindClothesCollectionViewCell.h"
#import "UIImageView+WebCache.h"
#import "VSFrameGrand.h"

@implementation VSFindClothesCollectionViewCell

- (void)dealloc
{
    [_MainImageView release];
    [_MainLabel release];
    [_FirstLabel release];
    [_model release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.MainImageView = [[[UIImageView alloc]init] autorelease];
        [self.contentView addSubview:self.MainImageView];
        
        self.MainLabel = [[[UILabel alloc]init] autorelease];
        [self.MainImageView addSubview:self.MainLabel];
         [self.MainLabel.layer setCornerRadius:12];
        self.MainLabel.layer.masksToBounds = YES;
       
        self.FirstLabel = [[[UILabel alloc]init] autorelease];
        [self.MainImageView addSubview:self.FirstLabel];
        

#warning 3
        self.MainLabel.hidden = YES;
        self.FirstLabel.hidden = YES;
#warning 3.0
        
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    self.MainImageView.frame = CGRectMake(0, 0, layoutAttributes.frame.size.width, layoutAttributes.frame.size.height);
    self.MainLabel.backgroundColor = [UIColor lightGrayColor];
    self.FirstLabel.backgroundColor = [UIColor clearColor];
    _LayoutWidth = layoutAttributes.frame.size.width;
    _LayoutHeight = layoutAttributes.frame.size.height;
   
}

- (void)setModel:(VSFindClothesModel *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    [self.MainImageView setImageWithURL:[NSURL URLWithString:model.cover_image_url]];

    self.MainLabel.frame = CGRectMake(- 4, _LayoutHeight - 24, 0.296 * SCREEN_WIDTH - 10, 18);
    self.FirstLabel.frame = CGRectMake(4, _LayoutHeight - 24, 0.296 * SCREEN_WIDTH - 10, 18);
    self.FirstLabel.font  = [UIFont fontWithName:@"Helvetica" size:13.0];
    self.FirstLabel.text = model.name;
    self.MainLabel.alpha = 0.5;
   
}









@end
